package com.xxxx.web.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxxx.web.dto.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 仓库用户表表
 */
@Data
@TableName("`WarehouseRelativeUser`")
public class WarehouseRelativeUser extends BaseEntity {


    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    @TableField(value = "WarehouseId", updateStrategy = FieldStrategy.IGNORED)
    private Integer WarehouseId;

    /**
     * 用户
     */
    @JsonProperty("UserId")
    @TableField(value = "UserId", updateStrategy = FieldStrategy.IGNORED)
    private Integer UserId;

    /**
     * 把仓库用户表实体转换成仓库用户表传输模型
     */
    public WarehouseRelativeUserDto MapToDto() throws InvocationTargetException, IllegalAccessException {
        WarehouseRelativeUserDto WarehouseRelativeUserDto = new WarehouseRelativeUserDto();

        BeanUtils.copyProperties(WarehouseRelativeUserDto, this);

        return WarehouseRelativeUserDto;
    }

}
